Global methods can be used in HyperPoints or in CygNet Studio without importing the library. To use them in other environments, create a COM component from the CxScript.GlobalFunctions library. Global methods include the following:
Note: Some of the examples in this topic use the WScript.Sleep statement, which is not recommended for use when scripting in CygNet Studio. Use TheView EventTimer instead.
Methods in parentheses indicate a hidden legacy script function.
The AcknowledgeAlarm method acknowledges an alarm for a specified point.
AcknowledgeAlarm(Tag As String)
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The point tag, in valid tag string format:
|
This method will only work in Live Mode. Enable or disable Live Mode using EnableLiveMode.
Example
The following example acknowledges an alarm.
|
Sub ackAlarm() EnableLiveMode True AcknowledgeAlarm "CYGDEMO.UIS.00000042" edtMessageBox.Text = "Alarm acknowledged" EnableLiveMode False End Sub |
The AddAuditTransactionComment method adds a comment for an Audit Transaction in the specified Service.
AddAuditTransactionComment(SiteService As String, AuditTransactionId as Unsigned Long, TransactionComment As String)
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of a service, in Site.Service format. |
|
AuditTransactionId |
Yes |
The Audit ID of the transaction to comment on. |
|
TransactionComment |
Yes |
A comment to add to the transaction. |
If the AuditTransactionId is invalid, no error will display.
Example
The following example adds a comment to transaction 1337 in CYGDEMO.UIS.
|
Sub addAuditComment() AddAuditTransactionComment "CYGDEMO.UIS", 1337, "This is a generic comment." edtMessageBox.Text = "Comment added" End Sub |
The AdjustTime method adjusts a date time by the specified adjustment string.
AdjustTime(ReferenceTime As Date, Adjustment as String) As Date
| Parameter | Required | Description |
|---|---|---|
|
ReferenceTime |
Yes |
The starting date time which to adjust. |
|
Adjustment |
Yes |
A string specifying the amount of time by which to adjust ReferenceTime. The space-separated elements in this string must be of the form "x-#", "x+#", or "x=#" where # is an integer and x is one of the following unit specifiers:
|
Example
The following example displays the current time and the adjusted time.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim dtNow, dtThen dtNow = Now() dtThen = GlobalFunctions.AdjustTime(dtNow, "y-1 m-1 d-1 H-1 M-1 S-1")
MsgBox dtNow MsgBox dtThen End Sub |
The ConvertLocalTimeToUTCTime method converts a local time to UTC.
ConvertLocalTimeToUTCTime(LocalTime As Date) As Date
| Parameter | Required | Description |
|---|---|---|
|
LocalTime |
Yes |
The local time to be converted to UTC. |
Example
The following example converts the current local time to UTC and displays both.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim dtLocal, dtUtc dtLocal = Now() dtUtc = GlobalFunctions.ConvertLocalTimeToUTCTime(dtLocal)
MsgBox dtLocal MsgBox dtUtc End Sub |
The ConvertUTCTimeToLocalTime method converts a UTC time to local time.
ConvertUTCTimeToLocalTime(UTCTime As Date) As Date
| Parameter | Required | Description |
|---|---|---|
|
UTCTime |
Yes |
The UTC time to be converted to local. |
Example
The following example converts the current local time to UTC and back to local, and displays both.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim dtLocal, dtUtc dtLocal = Now() dtUtc = GlobalFunctions.ConvertLocalTimeToUTCTime(dtLocal) dtLocal = GlobalFunctions.ConvertUTCTimeToLocalTime(dtUtc)
MsgBox dtUtc MsgBox dtLocal End Sub |
The CreateAuditTransaction method creates an Audit Transaction in the specified Service.
CreateAuditTransaction(SiteService As String, OperationId As String, OperationDescription As String, TransactionComment As String) As Long
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of a service, in Site.Service format. |
|
OperationId |
Yes |
A valid operation ID to perform. |
|
OperationDescription |
Yes |
A description for the operation. |
|
TransactionComment |
No |
A comment to add to the transaction. |
Return Value: The Audit Transaction ID of the new transaction.
Example
The following example creates an Audit transaction and displays its ID to the user.
|
Sub createTransaction() Dim iAudit iAudit = CreateAuditTransaction("CYGDEMO.UIS", "UISCMD_PERFORM", _ "Perfrm UIS Command", "") edtMessageBox.Text = "Transaction " & iAudit & " created" End Sub |
The CreateWaitCursor method creates a scoped WaitCursor object, changing the cursor to a wait cursor (for example, hourglass or other image) for the duration of the current scope.
When a WaitCursor object is instantiated via script, screens will "remember" that the cursor needs to be set back to the wait cursor if other components modify the cursor state for any reason. The cursor is set back to normal after the wait cursor object goes out of scope.
CreateWaitCursor() As WaitCursor
This method will only work when called within a process with user-visible windows (not command-line windows), such as CygNet Studio.
Example
The following example displays a wait cursor for the duration of a process.
|
Sub doCalculation() Dim objWaitCursor Set objWaitCursor = CreateWaitCursor()
Dim bDone bDone = False While Not(bDone) 'do some work Wend End Sub |
Note: See also CursorHelper Object.
The EnableLiveMode method enables or disables live mode.
EnableLiveMode(Enable As Boolean)
| Parameter | Required | Description |
|---|---|---|
|
Enable |
Yes |
Determines whether live mode is enabled (True) or disabled (False). |
Live mode must be enabled prior to using potentially harmful functions, like SendUISCommand and SetPoint. Live mode is enabled by default in HSS, but is disabled by default in CygNet Studio.
Example
This following method demonstrates enabling live mode in CygNet Studio before issuing a SetPoint command.
|
Sub SetPointValue(newValue) 'Enable live mode before calling a setpoint EnableLiveMode(True) SetPoint "CYGDEMO.UIS:POINT1", newValue, Now, 0 End Sub |
The EncryptString method encrypts a string.
EncryptString(Source As Date, DestString as String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Source |
Yes |
The source string to encrypt. |
|
DestString |
Yes |
The encrypted string returned by this method. |
This method will always return true.
Example
The following example encrypts a string and displays it in a message box.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim strEncrypted GlobalFunctions.EncryptString "My string", strEncrypted
MsgBox strEncrypted End Sub |
The GetAlarmState method returns the alarm state.
GetAlarmState(Status As Integer) As AlarmState
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
A valid Point ID number. |
Return Value: The state of the alarm as an integer. See Alarm State Enumeration Constants for what these integers mean.
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example gets the alarm state for point 00000123.
|
Sub getAlarmState() Dim iState iState = GetAlarmState(00000123) edtMessageBox.Text = "Alarm state integer is " & iState End Sub |
The GetAssociatedAcsName method gets the associated ACS name.
GetAssociatedAcsName(SiteService As String) As String
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. |
Example
The following example displays a message box containing the ACS name.
|
Sub getAcs() MsgBox GetAssociatedAcsName("CYGDEMO.UIS") End Sub |
The GetAssociatedAudName method gets the associated AUD service name.
GetAssociatedAudName(SiteService As String) As String
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. |
Example
The following example displays a message box containing the AUD service name.
|
Sub getAcs() MsgBox GetAssociatedAudName("CYGDEMO.UIS") End Sub |
The GetAssociatedFacName method gets the associated FAC service name.
GetAssociatedFacName(DdsCvsUisSiteService As String) As String
| Parameter | Required | Description |
|---|---|---|
|
DdsCvsUisSiteService |
Yes |
The name of the service from which to get information, in Site.Service format. |
Example
The following example displays a message box containing the FAC service name.
|
Sub getAcs() MsgBox GetAssociatedFacName("CYGDEMO.UIS") End Sub |
The GetAssociatedPointCfgName method gets the associated PNT service name.
GetAssociatedPointCfgName(CvsUisSiteService As String) As String
| Parameter | Required | Description |
|---|---|---|
|
CvsUisSiteService |
Yes |
The name of the service from which to get information, in Site.Service format. |
Example
The following example displays a message box containing the PNT service name.
|
Sub getAcs() MsgBox GetAssociatedPointCfgName("CYGDEMO.UIS") End Sub |
The GetAssociatedServiceName method returns the Site.Service of the specified type associated with the specified Site.Service.
GetAssociatedServiceName(SiteService As String, ServiceType as String) As String
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. The Site.Service for which to retrieve an associated service. |
|
ServiceType |
Yes |
The type of the associated service to retrieve. |
Example
The following example encrypts a string and displays it in a message box.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim strSiteService strSiteService = GlobalFunctions.GetAssociatedServiceName("CYGDEMO.DDS", "TRS")
MsgBox strSiteService End Sub |
The GetAssociatedTrsName method gets the associated TRS service name.
GetAssociatedTrsName(SiteService As String) As String
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. |
Example
The following example displays a message box containing the TRS service name.
|
Sub getAcs() MsgBox GetAssociatedTrsName("CYGDEMO.UIS") End Sub |
The GetAuditLevelGenserveInfoKeywords method gets a list of valid audit level keywords for a service.
GetAuditLevelGenserveInfoKeywords(SiteService As String) As Variant
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. |
Return Value: An array of keywords for the given service.
Example
The following example gets the audit level keywords for CYGDEMO.UIS and displays them in a list box.
|
Sub getGenserveKeywords() Dim arrList, item arrList = GetAuditLevelGenserveInfoKeywords("CYGDEMO.UIS")
For Each item In arrList lstFacilities.AddString(item) Next End Sub |
The GetCommandLineString method returns the command-line supplied to the calling application.
GetCommandLineString As String
The GetElapsedTime method returns the fractional seconds since the module load time.
GetElapsedTime() As Double
This method can be used in lieu of the VBScript Timer() method.
Example
The following example displays the elapsed time since the module load in a message box.
|
Sub WScript.Sleep(2000)
Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim dSeconds1 dSeconds1 = GlobalFunctions.GetElapsedTime()
WScript.Sleep(2000)
Dim dSeconds2 dSeconds2 = GlobalFunctions.GetElapsedTime()
MsgBox dSeconds1 'should display ~0 seconds MsgBox dSeconds2 'should display ~2 seconds End Sub |
The GetEnumerationTable method retrieves an enumeration table from a Table Reference Service.
GetEnumerationTable(SiteService As String, TableName As String, EnumTable As Variant)
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. A TRS service or any service with a TRS reference. |
|
TableName |
Yes |
The name of the table to retrieve. |
|
EnumTable |
Yes |
Output. A two dimensional array in order of: table entry, entry description. |
To view a list of all available table names, navigate to the specified TRS service in CygNet Explorer. The returned array will include one blank record following the returned values (see example).
Example
The following method displays the table entries in the CMPTYPE table in a message box.
|
Sub ShowTableEntries () Dim arrEntries, strDisplay, i strDisplay = ""
'Get the table entries GetEnumerationTable "CYGDEMO.TRS", "CMPTYPE", arrEntries
'Display each table entry For i=lbound(arrEntries) To ubound(arrEntries)-1 strDisplay = strDisplay & arrEntries(i,0) & ": " _ & arrEntries(i,1) & vbCr Next MsgBox strDisplay End Sub |
The GetFacilityInfo method gets facility information from the DDS.
GetFacilityInfo(DdsSiteService As String, Descriptor As String, FacilityInfo As Variant)
| Parameter | Required | Description |
|---|---|---|
|
DdsSiteService |
Yes |
The name of the service from which to get information, in Site.Service format. Defines the DDS site and service from which to get the facility information. |
|
Descriptor |
Yes |
Indicates the descriptor(s) to retrieve for the facility. See Remarks below for a list of possible descriptors. Multiple descriptors are semicolon delimited. |
|
FacilityInfo |
Yes |
Output. The two-dimensional array of facilities returned, in the order of: ID, Description, Type, Location, Contact |
Possible descriptors: DEVICE_ID, DEVICE_CATEGORY, DEVICE_TYPE, DEVICE_DESC, DEVICE_MANUF, DEVICE_MODEL, DEVICE_CLASS, DEVICE_REV, DEVICE_ENABLED, DEVICE_FACILITY, FACILITY_ID, FACILITY_DESC, FACILITY_TYPE, FACILITY_LOCATION, FACILITY_CONTACT. You can use CygNet Explorer, specifically the DDS and FAC service panes, to find possible values of the above parameters.
Example
The following function populates a list box, lstFacilities, with the facility names in the "CYGDEMO.UIS" service. The device descriptor, "DEVICE_CATEGORY=RD," restricts the returned list to remote devices that are enabled.
|
Sub ListFacilities () Dim arrFacInfo, strDescriptor, strFacId
'Get only enabled remote devices (RD) strDescriptor = "DEVICE_CATEGORY=RD;DEVICE_ENABLED=YES" GetFacilityInfo "CYGDEMO.UIS", strDescriptor, arrFacInfo
'Extract each facility ID (the first field in the array) and 'place in a list box For i = lbound(arrFacInfo) To ubound(arrFacInfo) strFacId = arrFacInfo(i, 0) lstFacilities.AddString(strFacId) Next
'Leave the first item selected lstFacilities.Selection = 0 lstFacilities.RunChange End Sub |
The GetFacilityList method returns a list of facility IDs in a CVS.
GetFacilityList(CvsSiteService As String, FacilityList As Variant)
| Parameter | Required | Description |
|---|---|---|
|
CvsSiteService |
Yes |
The name of the service from which to get information, in Site.Service format. Defines the CVS site and service. |
|
FacilityList |
Yes |
Output. The array of facilities received. |
Example
The following example fills a list box with facility names on the CYGDEMO.UIS service.
|
Sub ListFacilities () Dim arrFacs, i lstFacilities.ResetContent
'Get facilities GetFacilityList "CYGDEMO.UIS", arrFacs
'Display results in list box For i=lbound(arrFacs) To ubound(arrFacs) lstFacilities.AddString arrFacs (i) Next End Sub |
The GetGenserveInfo method gets a list of general information about a service.
GetGenserveInfo(SiteService As String, Request As String, GenserveInfo As Variant)
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. |
|
Request |
Yes |
A semicolon delimited list of requests. See Info Items for a complete list of info items that may be requested. |
|
GenserveInfo |
Yes |
Output. A two dimensional array in order of: type, value, type "nice name." |
Example
The following method displays all executable-related parameters for a given service in a message box. The returned array will include one blank record following the returned values (see example).
|
Sub ShowServInfo (strService) Dim arrServinfo, strRequest, i, strDisplay strDisplay = ""
strRequest = "EXE_NAME;EXE_SIZE;EXE_TIME;EXE_VER"
'Get the service information GetGenserveInfo strService, strRequest, arrServInfo
'Display each service parameter For i=lbound(arrServInfo) To ubound(arrServInfo) strDisplay = strDisplay & arrServinfo(i,2) & ": " _ & arrServInfo(i,1) & vbCr Next MsgBox strDisplay End Sub |
The GetODBCConnectionString method returns the ODBC connection string for a given service filter.
GetODBCConnectionString(SiteServiceFilter As String) As String
| Parameter | Required | Description |
|---|---|---|
|
SiteServiceFilter |
Yes |
A comma-separated service filter string which allows the use of wildcards (for example, "CYG*.*,MYSITE.UIS). |
Example
The following example retrieves the ODBC connection string for service filter "CYGDEMO.*".
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim strOdbcConn strOdbcConn = GlobalFunctions.GetODBCConnectionString("CYGDEMO.*")
MsgBox strOdbcConn End Sub |
The GetServiceDef method retrieves site service definition for a single specified service.
GetServiceDef(SiteService As String, ServiceDef As Variant)
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. The Site.Service for which to retrieve the service definition. |
|
ServiceDef |
Yes |
The array representing the service definition returned by this method. The array order is defined as follows: 0 Site.Service 1 Name of site 2 Name of service 3 Service type 4 Description of service 5 StreetTalk name of service 6 Name of backup server site 7 Name of backup server service 8 Name of owner, site 9 Name of owner, service 10 Status of service 11 Address of service 12 Record version # 13 16 bit record type 14 Status of server |
This method allows the retrieval of a service definition of a single service. To retrieve service definitions of multiple services, use GetServiceDefs method.
Example
The following example retrieves the service definition for CYGDEMO.UIS and displays the service description in a message box.
|
Sub ShowUISDefs () Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim aryServDef GlobalFunctions.GetServiceDef "CYGDEMO.UIS", aryServDef
MsgBox aryServDef(4) End Sub |
The GetServiceDefs method retrieves multiple service definitions for services within a specified ARS.
GetServiceDefs(ArsSiteService As String, ServiceTypeFilter As String, ServiceStatusFilter As String, ServiceNameFilter As String, SiteNameFilter As String, ServiceDefs As Variant)
| Parameter | Required | Description |
|---|---|---|
|
ArsSiteService |
Yes |
The name of the service from which to get information, in Site.Service format. The ARS Site.Service from which to get definitions. If this parameter is an empty string, the service definitions will be retrieved from the default ARS. |
|
ServiceTypeFilter |
Yes |
A semicolon delimited list of service types to retrieve. If this parameter is an empty string, all service types will be retrieved. |
|
ServiceStatusFilter |
Yes |
A semicolon delimited list of statuses to retrieve. If this parameter is an empty string, all service statuses will be retrieved. |
|
ServiceNameFilter |
Yes |
A semicolon delimited list of service names to retrieve. If this parameter is an empty string, all service names will be retrieved. |
|
SiteNameFilter |
Yes |
A semicolon delimited list of site names to retrieve. If this parameter is an empty string, all site names will be retrieved. |
|
ServiceDefs |
Yes |
The two-dimensional array of service definitions returned by this method. The array order is defined as follows: 0 Site.Service 1 Name of site 2 Name of service 3 Service type 4 Description of service 5 StreetTalk name of service 6 Name of backup server site 7 Name of backup server service 8 Name of owner, site 9 Name of owner, service 10 Status of service 11 Address of service 12 Record version # 13 16 bit record type 14 Status of server |
This method allows the retrieval of the service definitions of multiple services. To retrieve the service definition of a single service, use GetServiceDef.
Example
The following method shows a message box listing the names and descriptions of all UIS, DDS, and FAC services in the system with status "OK".
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim aryServDefs GlobalFunctions.GetServiceDefs "PFAKE.ARS", "UIS;DDS;FAC", _ "OK", "", "", aryServDefs
Dim strResp, i For i=lbound(aryServDefs) To ubound(aryServDefs) strResp = strResp & aryServDefs(i,0) & " " _ & aryServDefs(i,4) & vbCr Next
MsgBox strResp End Sub |
The GetTagList method returns a list of point tags from a Point Service.
GetTagList(PointCfgOrCvsSiteService As String, Filter As String, GetLongId As Boolean, TagList As Variant)
| Parameter | Required | Description |
|---|---|---|
|
PointCfgOrCvsSiteService |
The name of the service from which to get information, in Site.Service format. A CVS or PNT service. |
|
|
Filter |
Yes |
A semicolon delimited naming filter to select certain tags. Possible filters include:
Wildcards are not allowed. |
|
GetLongId |
Yes |
True returns the Long Point ID; False returns the Short Point ID. |
|
TagList |
Yes |
Output. The array of tag strings returned. |
The returned tag list is an array of Point IDs in "Site.Service.PointID" format.
Example
The following example fills a list box, lstTags, with tags from the provided facility.
|
Sub DisplayTagList (facility) Dim arrTagList, i lstTags.ResetContent
'Get tags from the facility GetTagList "CYGDEMO.PNT", "FACILITY=" & facility, False, arrTagList
'Display results in list box For i=lbound(arrTagList) To ubound(arrTagList) lstTags.AddString arrTagList(i) Next End Sub |
The GetUdcDescription method gets a UDC description based on a UDC name and service.
GetUdcDescription(SiteService As String, Udc As String) As String
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. |
|
Udc |
Yes |
A valid name of a UDC in the Site.Service. |
The returned value is the UDC description string.
Example
The following method demonstrates the usage of GetUdcDescription for a sample UDC, PSTATIC.
|
Sub ShowUDCDesc () Dim desc desc = GetUdcDescription("CYGDEMO.UIS", "PSTATIC") MsgBox "PSTATIC Description: " & desc End Sub |
The GetUdcFormatInfo method gets the format of a UDC.
GetUdcFormatInfo(SiteService As String, Udc As String) As String
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. |
|
Udc |
Yes |
A valid name of a UDC in the Site.Service. |
Return Value: A string containing the format info for the UDC.
Example
The following example gets the format of a UDC and stores it in a text box.
|
Sub getFormat() Dim strRet strRet = GetUdcFormatInfo("CYGDEMO.UIS", "SVMSVST") edtMessageBox.Text = strRet End If |
The GetUdcList method gets a list of UDCs in the specified facility.
GetUdcList(FacilityTag As String, UdcList As Variant) As Type
| Parameter | Required | Description |
|---|---|---|
|
FacilityTag |
Yes |
A valid facility tag to retrieve the UDC list from. |
|
UdcList |
Yes |
Output. Stores the list of UDCs. |
Example
The following example displays all the UDCs in CYG_METER.
|
Sub getUdc() Dim arrUDC, item GetUdcList "CYGDEMO.UIS::CYG_METER", arrUDC For Each item In arrUDC lstUDC.AddString(item) Next End Sub |
The GetUisCommandList method gets a list of UIS commands for the specified facility.
GetUisCommandList(UisOrDdsSiteService As String, FacilityID As String, SelectionMask As Integer, UisCmdInfo As Variant)
| Parameter | Required | Description |
|---|---|---|
|
UisOrDdsSiteService |
Yes |
The name of a valid UIS or DDS from which to get information , in Site.Service format. |
|
FacilityID |
Yes |
Defines the facility ID for the command list. |
|
SelectionMask |
Yes |
Indicates which subset of commands to retrieve using a bit mask. Available flags are enumerated in CmdSelectionBits. |
|
UisCmdInfo |
Yes |
Output. The two-dimensional array of commands returned, in order of: Facility ID, Command Name, command description, security granted (Boolean) |
If you have more than one type of command you wish to retrieve, "OR" the constants from the CmdSelectionBits together and use the resulting value as the selection mask.
Example
The following function retrieves UIS command information for the METER206 facility and displays the command descriptions in a list box. The selection mask enables retrieval of parent and hidden data group information (1 + 4 = 5 = 00000101)
|
Sub ListUisCommands() Dim arrCmds, i lstCommands.ResetContent
'Get command list GetUisCommandList "CYGDEMO.UIS", "METER206", 5, arrCmds
'Display each command description in a list box For i=lbound(arrCmds) To ubound(arrCmds) lstCommands.AddString arrCmds(i, 2) Next End Sub |
The GetUisFromDds method gets the UIS service name from a DDS service.
GetUisFromDds(DdsSiteService As String) As String
| Parameter | Required | Description |
|---|---|---|
|
DdsSiteService |
Yes |
The name of the service from which to get information, in Site.Service format. A valid DDS service. |
Return Value: The name of the UIS, in "Site.Service" format. If DdsSiteService is invalid, an empty string is returned.
Example
The following example gets the UIS service from CYGDEMO.DDS.
|
Sub getUIS() Dim strUIS strUIS = GetUisFromDds("CYGDEMO.DDS") edtMessageBox.Text = strUIS End Sub |
The IsAnalogPoint method returns true if the point type is analog.
IsAnalogPoint(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
Example
The following example tests if the given point is an analog point.
|
Sub isAnalog() If IsAnalogPoint(277) Then edtMessageBox.Text = "Point 277 is an analog point" Else edtMessageBox.Text = "Point 277 is not an analog point" End If End Sub |
The IsDigitalAlarm method returns true if the digital point is in the digital alarm state.
IsDigitalAlarm(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in digital alarm.
|
Sub isDigAlarm() If IsDigitalAlarm(277) Then edtMessageBox.Text = "Point 277 is in digital alarm" Else edtMessageBox.Text = "Point 277 is not in digital alarm" End If End Sub |
The IsDigitalChattering method returns true if the digital point is chattering.
IsDigitalChattering(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is chattering.
|
Sub isChattering() If IsDigitalChattering(277) Then edtMessageBox.Text = "Point 277 is chattering" Else edtMessageBox.Text = "Point 277 is not chattering" End If End Sub |
The IsDigitalPoint method returns true if the point type is digital.
IsDigitalPoint(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
Example
The following example tests if the given point is a digital point.
|
Sub isDigital () If IsDigitalPoint(277) Then edtMessageBox.Text = "Point 277 is a digital point" Else edtMessageBox.Text = "Point 277 is not a digital point" End If End Sub |
The IsDigitalWarning method returns true if the digital point is in the digital warning state.
IsDigitalWarning(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in digital warning.
|
Sub isDigWarning() If IsDigitalWarning(277) Then edtMessageBox.Text = "Point 277 is in digital warning" Else edtMessageBox.Text = "Point 277 is not in digital warning" End If End Sub |
The IsEnumAlarm1 method returns true if the enumeration point is in Alarm 1.
IsEnumAlarm1(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in enumeration alarm 1.
|
Sub isEnum1() If IsEnumAlarm1(277) Then edtMessageBox.Text = "Point 277 is in enumeration alarm 1" Else edtMessageBox.Text = "Point 277 is not in enumeration alarm 1" End If End Sub |
The IsEnumAlarm2 method returns true if the enumeration point is in Alarm 2.
IsEnumAlarm2(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in enumeration alarm 2.
|
Sub isEnum2() If IsEnumAlarm2(277) Then edtMessageBox.Text = "Point 277 is in enumeration alarm 2" Else edtMessageBox.Text = "Point 277 is not in enumeration alarm 2" End If End Sub |
The IsEnumAlarm3 method returns true if the enumeration point is in Alarm 3.
IsEnumAlarm3(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in enumeration alarm 3.
|
Sub isEnum3() If IsEnumAlarm3(277) Then edtMessageBox.Text = "Point 277 is in enumeration alarm 3" Else edtMessageBox.Text = "Point 277 is not in enumeration alarm 3" End If End Sub |
The IsEnumAlarm4 method returns true if the enumeration point is in Alarm 4.
IsEnumAlarm4(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in enumeration alarm 4.
|
Sub isEnum4() If IsEnumAlarm4(277) Then edtMessageBox.Text = "Point 277 is in enumeration alarm 4" Else edtMessageBox.Text = "Point 277 is not in enumeration alarm 4" End If End Sub |
The IsEnumAlarm5 method returns true if the enumeration point is in Alarm 5.
IsEnumAlarm5(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in enumeration alarm 5.
|
Sub isEnum5() If IsEnumAlarm5(277) Then edtMessageBox.Text = "Point 277 is in enumeration alarm 5" Else edtMessageBox.Text = "Point 277 is not in enumeration alarm 5" End If End Sub |
The IsEnumAlarm6 method returns true if the enumeration point is in Alarm 6.
IsEnumAlarm6(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in enumeration alarm 6.
|
Sub isEnum6() If IsEnumAlarm6(277) Then edtMessageBox.Text = "Point 277 is in enumeration alarm 6" Else edtMessageBox.Text = "Point 277 is not in enumeration alarm 6" End If End Sub |
The IsEnumPoint method returns true if the point type is enumeration.
IsEnumPoint(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
Example
The following example tests if the given point is an enumeration point.
|
Sub isEnum() If IsEnumPoint(277) Then edtMessageBox.Text = "Point 277 is an enumeration point" Else edtMessageBox.Text = "Point 277 is not an enumeration point" End If End Sub |
The IsHighAlarm method returns true if the analog point is in High Alarm.
IsHighAlarm(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in high alarm.
|
Sub isHiAlarm() If IsHighAlarm(277) Then edtMessageBox.Text = "Point 277 is in high alarm" Else edtMessageBox.Text = "Point 277 is not in high alarm" End If End Sub |
The IsHighDeviation method returns true if the analog point is in High Deviation.
IsHighDeviation(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in high deviation.
|
Sub isHighDev () If IsHighDeviation(277) Then edtMessageBox.Text = "Point 277 is in high deviation" Else edtMessageBox.Text = "Point 277 is not in high deviation" End If End Sub |
The IsHighOutOfRange method returns true if the analog point is High Out-of-Range.
IsHighOutOfRange(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is high out-of-range.
|
Sub isHighOOR() If IsHighOutOfRange(277) Then edtMessageBox.Text = "Point 277 is out-of-range" Else edtMessageBox.Text = "Point 277 is not out-of-range" End If End Sub |
The IsHighWarning method returns true if the analog point is in High Warning.
IsHighWarning(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point in high warning.
|
Sub isHiWarning() If IsHighWarning(277) Then edtMessageBox.Text = "Point 277 is in high warning" Else edtMessageBox.Text = "Point 277 is not in high warning" End If End Sub |
The IsInitialized method returns true if the point is initialized.
IsInitialized(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
Example
The following example tests if the given point is initialized.
|
Sub isInitialized() If IsInitialized(277) Then edtMessageBox.Text = "Point 277 is initialized" Else edtMessageBox.Text = "Point 277 is not initialized" End If End Sub |
The IsInputPoint method returns true if the point is an input point.
IsInputPoint(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
Example
The following example tests if the given point is an input point.
|
Sub isInput() If isInputPoint(277) Then edtMessageBox.Text = "Point 277 is an input point" Else edtMessageBox.Text = "Point 277 is not an input point" End If End Sub |
The IsLowAlarm method returns true if the analog point is in Low Alarm.
IsLowAlarm(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in low alarm.
|
Sub isLoAlarm() If IsLowAlarm(277) Then edtMessageBox.Text = "Point 277 is in low alarm" Else edtMessageBox.Text = "Point 277 is not in low alarm" End If End Sub |
The IsLowOutOfRange method returns true if the analog point is Low Out-of-Range.
IsLowOutOfRange(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is low out-of-range.
|
Sub isLowOOR() If IsLowOutOfRange(277) Then edtMessageBox.Text = "Point 277 is low out-of-range" Else edtMessageBox.Text = "Point 277 is not low out-of-range" End If End Sub |
The IsLowWarning method returns true if the analog point is in the Low Warning state.
IsLowWarning(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in low warning.
|
Sub isLoWarning() If IsLowWarning(277) Then edtMessageBox.Text = "Point 277 is in low warning" Else edtMessageBox.Text = "Point 277 is not in low warning" End If End Sub |
The IsOutputPoint method returns true if the point type is an output point.
IsOutputPoint(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
Example
The following example tests if the given point is an output point.
|
Sub isOutput() If IsOutputPoint(277) Then edtMessageBox.Text = "Point 277 is an output point" Else edtMessageBox.Text = "Point 277 is not an output point" End If End Sub |
The IsSetPointAuthorized method determines whether or not setpoints are authorized for a given service.
IsSetPointAuthorized(Tag As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The point tag, in valid tag string format:
|
This method can be used to check whether a setpoint is authorized before proceeding with the setpoint. Setpoints are not authorized when the ACS associated with the specified CVS service has not granted the script 'setpoint' privileges.
Example
The following example tests if the given point is an output point.
|
Sub isAuthorized() If IsSetPointAuthorized(CYGDEMO.UIS.00000277) Then edtMessageBox.Text = "Point 277 is authorized for setpoints" Else edtMessageBox.Text = "Point 277 is not authorized for setpoints" End If End Sub |
The IsStringAlarm1 method returns true if the string point is in Alarm 1.
IsStringAlarm1(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in alarm 1.
|
Sub isString1() If IsStringAlarm1(277) Then edtMessageBox.Text = "Point 277 is in alarm 1" Else edtMessageBox.Text = "Point 277 is not in alarm 1" End If End Sub |
The IsStringAlarm2 method returns true if the string point is in Alarm 2.
IsStringAlarm2(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in alarm 2.
|
Sub isString2() If IsStringAlarm2(277) Then edtMessageBox.Text = "Point 277 is in alarm 2" Else edtMessageBox.Text = "Point 277 is not in alarm 2" End If End Sub |
The IsStringAlarm3 method returns true if the string point is in Alarm 3.
IsStringAlarm3(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in alarm 3.
|
Sub isString3() If IsStringAlarm3(277) Then edtMessageBox.Text = "Point 277 is in alarm 3" Else edtMessageBox.Text = "Point 277 is not in alarm 3" End If End Sub |
The IsStringAlarm4 method returns true if the string point is in Alarm 4.
IsStringAlarm4(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in alarm 4.
|
Sub isString4() If IsStringAlarm4(277) Then edtMessageBox.Text = "Point 277 is in alarm 4" Else edtMessageBox.Text = "Point 277 is not in alarm 4" End If End Sub |
The IsStringAlarm5 method returns true if the string point is in Alarm 5.
IsStringAlarm5(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in alarm 5.
|
Sub isString5() If IsStringAlarm5(277) Then edtMessageBox.Text = "Point 277 is in alarm 5" Else edtMessageBox.Text = "Point 277 is not in alarm 5" End If End Sub |
The IsStringAlarm6 method returns true if the string point is in Alarm 6.
IsStringAlarm6(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
This method is a hidden legacy script function, and will not work if a point scheme other than CygNet Standard Point Scheme (0) is defined. See Legacy Script Functions for more information.
Example
The following example tests if the given point is in alarm 6.
|
Sub isString6() If IsStringAlarm6(277) Then edtMessageBox.Text = "Point 277 is in alarm 6" Else edtMessageBox.Text = "Point 277 is not in alarm 6" End If End Sub |
The IsStringPoint method returns true if the point type is string.
IsStringPoint(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
Example
The following example tests if the given point is an analog point.
|
Sub isString() If IsStringPoint(277) Then edtMessageBox.Text = "Point 277 is a string point" Else edtMessageBox.Text = "Point 277 is not a string point" End If End Sub |
The IsUnreliable method returns true if the point is unreliable.
IsUnreliable(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
Example
The following example tests if the given point is unreliable.
|
Sub isUnreliableTest() If IsUnreliable(277) Then edtMessageBox.Text = "Point 277 is unreliable" Else edtMessageBox.Text = "Point 277 is reliable" End If End Sub |
The IsUpdated method returns true if the point is updated.
IsUpdated(Status As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Status |
Yes |
The base status integer for a point. This can be found from the Status property in the Points object. |
Example
The following example tests if the given point is updated.
|
Sub isUpdatedTest() If IsUpdated(277) Then edtMessageBox.Text = "Point 277 is updated" Else edtMessageBox.Text = "Point 277 is not an updated" End If End Sub |
The ParseCygNetDateTimeStringToLocalTime method parses a CygNet date time string (YYYYMMDDhhmmsssnnn) into a local time.
ParseCygNetDateTimeStringToLocalTime(CygNetDateTimeString As String, TimeIsLocal As Boolean) As Date
| Parameter | Required | Description |
|---|---|---|
|
CygNetDateTimeString |
Yes |
A CygNet date time string (of the form YYYYMMDDhhmmsssnnn) to parse. The fractional seconds portion of the string (nnn) is not required, but it may be specified as either a hundredths-precision decimal (nn) or a thousandths-precision decimal (nnn). For example, "2011010308523022" translates to "01/03/2011 08:52:30.22", whereas "20110103085230222" translates to "01/03/2011 08:52:30.222". |
|
TimeIsLocal |
No |
If this parameter is set to false, the CygNetDateTimeString parameter will be interpreted as a UTC time. Otherwise, it will be interpreted as a local time. The default value of this parameter is false. |
Example
The following example parses a UTC CygNet date time to a local VBScript date time and displays the result in a message box.
|
Sub removeSuppression() Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim dtLocal dtLocal = GlobalFunctions.ParseCygNetDateTimeStringToLocalTime("20110103085230")
MsgBox dtLocal End Sub |
The PrepUdcForLoad method adds the UDC to the list of UDCs to refresh when calling GetUdcDescription. It is useful when making multiple subsequent calls to GetUdcDescription.
PrepUdcForLoad(SiteService As String, Udc As String)
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of the service from which to get information, in Site.Service format. Specify a CVS, UIS, PNT or TRS service name to look up the UDC. |
|
Udc |
Yes |
A valid name of a UDC in the Site.Service to look up. |
The RemoveAlarmSuppression method removes alarm suppression on the provided point.
RemoveAlarmSuppression(PointTag As String)
| Parameter | Required | Description |
|---|---|---|
|
PointTag |
Yes |
The point tag, in valid tag string format:
|
Example
The following example removes suppression for point 00000063.
|
Sub removeSuppression() RemoveAlarmSuppression "CYGDEMO.UIS.00000063" edtMessageBox.Text = "Alarm suppression removed" End Sub |
The ResolvePoints method resolves a list of facility UDCs or Long Point IDs to Short Point IDs.
ResolvePoints(CvsSiteService As String, TagList As Variant, PointList As Variant)
| Parameter | Required | Description |
|---|---|---|
|
CvsSiteService |
Yes |
The name of the service from which to get information, in Site.Service format. Defines the CVS site and service. |
|
TagList |
Yes |
An array of Long Point IDs or facility UDCs (in "FACILITY.UDC" format) to convert to Short Point IDs |
|
PointList |
Yes |
Output. The array of Short Point IDs returned |
This function is generally used in situations where the client application only handles Short Point IDs.
Example
The following function serves as a wrapper for the ResolvePoints method by taking an array of Long Point ID strings or UDC strings and returning an array of Short Point IDs.
|
Function ToShortId (arrPoints) Dim arrShort
'Resolve points ResolvePoints "CYGDEMO.UIS", arrPoints, arrShort
ToShortId = arrShort End Function |
The ResolvePointTags method resolves a list of Site.Service::Facility.Udc tags or Site.Service:LongPointId tags to Site.Service.ShortPointId tags.
ResolvePointTags(TagListIn As Variant, TagListOut As Variant)
| Parameter | Required | Description |
|---|---|---|
|
TagListIn |
Yes |
An array containing point tags in Site.Service::Facility.UDC or Site.Service:LongPointId form. It is not necessary to use the same form for each tag. |
|
TagListOut |
Yes |
The array of resolved point tags returned by this method, in the form Site.Service.ShortPointId. |
Example
The following example resolves three point tags and displays them in a message box.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim vTagsIn ReDim vTagsIn(2)
vTagsIn(0) = "CYGDEMO.UIS:ENTOPS_SYEDSOPCH" vTagsIn(1) = "CYGDEMO.UIS::ENTOPS1.SYEDSOPCH" vTagsIn(2) = "CYGDEMO.UIS::ENTOPS_GQDOWNLOAD.SYEDSOPCH"
Dim vTagsOut GlobalFunctions.ResolvePointTags vTagsIn, vTagsOut
Dim i, strResp For i = 0 To UBound(vTagsOut) strResp = strResp + vbCr + vTagsIn(i) + " " + vTagsOut(i) Next
MsgBox strResp End Sub |
The ScaleEngToRaw method returns a raw value from an engineering value based on scaling.
ScaleEngToRaw(Tag As String, EngValue As Double) As Double
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
A valid point tag from which scaling values are used.
The point tag, in valid tag string format:
|
|
EngValue |
Yes |
An engineering value to be scaled. |
Return Value: The value of the converted engineering number.
Example
The following example scales a number to a raw value.
|
Sub toRaw() Dim dRaw dRaw = ScaleEngToRaw("CYGDEMO.UIS.00000171", 2.71) edtMessageBox.Text = "2.71 scaled to raw is " & dRaw End Sub |
The ScaleRawToEng method returns an engineering value from a raw value based on scaling.
ScaleRawToEng(Tag As String, RawValue As Double) As Double
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
A valid point tag from which scaling values are used.
The point tag, in valid tag string format:
|
|
RawValue |
Yes |
A raw value to be scaled. |
Return Value: The value of the converted raw number.
Example
The following example scales a number to an engineering value.
|
Sub toEng() Dim dEng dEng = ScaleRawToEng("CYGDEMO.UIS.00000171", 3.14) edtMessageBox.Text = "3.14 scaled to engineering is " & dEng End Sub |
The SendUisCommand method sends a command to a UIS or DDS for a specified facility. Also see CxUis.UisClient.SendUisCommand.
SendUISCommand(UisOrDdsSiteService As String, FacilityID As String, Command As String, [Parameters As String], [StatusPointID As String])
| Parameter | Required | Description |
|---|---|---|
|
UisOrDdsSiteService |
Yes |
The name of a valid UIS or DDS from which to get information , in Site.Service format. The UIS or DDS in which the command is defined. |
|
FacilityID |
Yes |
The facility ID that has the UIS command. |
|
Command |
Yes |
The name of the UIS command. |
|
Parameters |
No |
Parameters for the command, if necessary. Use an empty string if none specified. |
|
StatusPointID |
No |
The tag string of an optional status point for the command (in progress, completed, success, etc.). Use an empty string if none specified. |
The optional UIS command parameters are sent in semicolon delimited format. The status point, if used, is updated automatically. In CygNet Studio, the UIS Command Button object can also be used.
The command priority for a scripted UIS command can be assigned; by setting the UisCmdPriority=<priority> parameter where <priority> is one of the following 'Low', 'Medium', 'High', 'User', or 'Admin'.
See Prioritizing Messages in the Communication Queue for more information.
Example — Open valve when tank level is in high alarm
The following example sends an "OPENVALVE" UIS command to the WELL05 facility on CYGDEMO.UIS when the tank level (as monitored by a separate point) is in high alarm. The status of the command is sent to a separate point.
|
Sub WELL05_TANK_LEVEL_CMD_OnUpdate(EventType) 'Get a snapshot of the tank level point Set TankState = Points.Point("CYGDEMO.UIS:TANK_LEVEL;STATUS")
'Check for a high alarm If (TankState.Status And hpStatusHighAlarm) <> 0 Then 'Send a Command to the UIS SendUISCommand "CYGDEMO.UIS", "WELL05", "OPENVALVE", "", _ "CYGDEMO.UIS::WELL05_TANK_LEVEL_CMD_STATUS" End If End Sub |
Example — Using DG_F_DEV or DG_T_DEV component types
The following examples show how to send a UIS Command that is not predefined on a device. This example allows you to specify the DG_F_DEV or DG_T_DEV component type, then the data group ordinal (DGORD) and data group type (DGTYPE) that you want to poll.
The same functionality is available with the CxUis method SendUisCommand.
DG_T_DEV
|
Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions") Call GlobalFunctions.EnableLiveMode (True) GlobalFunctions.SendUISCommand "CYGDEMO.UIS", "WELLPILOT_KS_WELL00", "DG_T_DEV", "DGORD=0;DGTYPE=ProVlvOpCl;OpenClose=1", "" |
DG_F_DEV
|
Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions") Call GlobalFunctions.EnableLiveMode (True) GlobalFunctions.SendUISCommand "CYGDEMO.UIS", "WELLPILOT_KS_WELL00", "DG_F_DEV", "DGORD=0;DGTYPE=BasicPoll", "" |
where
Script Element Corresponds to More information GlobalFunctions.SendUisCommand
Global Send UIS Command
CYGDEMO.UIS
CygNet Site.Service
WELLPILOT_KS_WELL00
Facility
DG_T_DEV (to send a data group to a field device)
DG_F_DEV (to get a data group from a field device)
Component type
DGORD
Ordinal of the data group (for example, 0)
DGTYPE
Data group type (for example, ProVlvOpCl – is the Production Valve Open and Close data group)
OpenClose
Parameters to send to the device (for example, Open = 1 and Close = 0)
UIS Command Components
Note: You can find the Component Type, Data Group Ordinal, and Data Group Type in the properties of the Data Group. All of the information above is available in the UIS Command Properties, if you have a UIS command created already but want to use a script to run the command.
The ServicePing method sends a request for data from a specified service.
ServicePing(SiteService As String, ByteCount As Integer, Operation As Integer, OperationParam As Integer, PingErrDesc As Variant, PingTime As Variant) As Variant
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of a service, in Site.Service format. |
|
ByteCount |
Yes |
The ping request number of bytes. |
|
Operation |
Yes |
The ping operation to perform. Operations are: 0 Increment byte values up to OperationParam bytes 1 Randomize byte values up to OperationParam bytes 2 Set byte values to OperationParam up to ByteCount 3 Same as 0, but force "work" to take OperationParam milliseconds (range 0-1000 ms). Use carefully! 4 Returns the service name |
|
OperationParam |
Yes |
Sets the operation parameter for the above Operation. |
|
PingErrDesc |
Yes |
Output. The returned error description. |
|
PingTime |
Yes |
Output. The returned ping time in milliseconds. |
The result of the method is returned as a number indicating one of the following error messages.
| Error | Description |
|---|---|
| 0 | Success |
| 1 | Server did not wait long enough before it responded |
| 2 | Invalid ping operation specified |
| 3 | Invalid ping operation parameter specified |
| 4 | Received number of bytes differs from requested |
| 5 | Received bytes were not incremented as requested |
| 6 | Received bytes were not set as requested |
| 7 | Service rejected ping request message |
Example
The following method pings the CYGDEMO.DDS service and displays the results in a message box.
|
Sub PingService () Dim siteService, pingTime, pingError, ret siteService = "CYGDEMO.DDS"
'Send ping request Ret = ServicePing (siteService, 0, 0, 0, pingError, pingTime)
'Display results based on return value If ret <> 0 Then MsgBox "ServicePing returned with the following error: " & pingError Else MsgBox "Ping time for " & strService & " was " & pingTime & " ms." End If End Sub |
The SetAlarmSuppressionSettings method sets the provided point’s alarm suppression as specified.
SetAlarmSuppressionSettings(PointTag As String, SuppressionEndDate As Date, EndSuppressionOnNormal As Boolean)
| Parameter | Required | Description |
|---|---|---|
|
PointTag |
Yes |
The point tag, in valid tag string format:
|
|
SuppressionEndDate |
Yes |
Suppression will be disabled if the point is still in alarm state at this date. |
|
EndSuppressionOnNormal |
Yes |
Set to True to disable suppression when the point’s state is normal. |
Example
The following example suppresses an alarm until December 21, 2017 at 3:13 or until it returns to normal state.
|
Sub setAllarmSuppression() SetAlarmSuppressionSettings "CYGDEMO.UIS.00000063", _ "12/21/2017 3:13:00 PM", True edtMessageBox.Text = "Alarm suppressed" End Sub |
The SetGenserveInfo method sets an Info Keyword task. See the SVCINFO Security Event for the applicable CygNet Service in the Security Reference topics for more information about GenServe security management.
SetGenserveInfo(SiteService As String, Request As String, SetGenserveInfoResult As Variant)
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The name of a service, in Site.Service format. |
|
Request |
Yes |
Specifies the Info Keyword to send to the service. Options are:
|
|
SetGenserveInfoResult |
Yes |
Output. A two-dimensional array in order of: type, return value (boolean), error code, error message. |
If using BACKUP_NOW, the files will be backed up into the directory specified by the BACKUP_PATH keyword in the service configuration file. For more information see on VHS Journal Files and Service Backups on Demand.
Example
The following example backs up CYGDEMO.UIS and alerts the user if it was successful.
|
Sub setInfoKey() Dim arrGsResults SetGenserveInfo "CYGDEMO.UIS", "BACKUP_NOW=TRUE", arrGsResults If arrGsresults(0, 1) = -1 Then msgbox "Backup successful" Else msgbox "Backup request rejected" End If End Sub |
The SetPoint method sets a point to a specified value. For more information about adding a SetPoint button to a CygNet Studio screen, see the SetPoint Button Tool.
Note: When updating point values (via a value edit in CygNet Explorer, using the TextImport EIE, or via a SetPoint object) all changes are pushed through to the associated CVS (UIS, HSS, and OPCIS). In the case of the OPCIS, you cannot do a text import or a setpoint to an OPCIS point if an external OPC server ID is configured (in the External ID field of the Point reference page of the PNT Editor) because any update is routed back through the external OPC server. This makes it impossible to backfill historical data for a tag that "belongs" to an OPC server.
SetPoint(Tag As String, RawValue As String, [Timestamp As Date], [Status As Integer])
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The point tag, in valid tag string format:
|
|
RawValue |
Yes |
The new value to be written. |
|
Timestamp |
No |
The timestamp to be assigned to this value. |
|
Status |
No |
The status bit to be updated for the point. |
Example
This sample HSS point converts the value of a temperature point in Centigrade to another point in Fahrenheit.
|
Sub TEMP_CONVERT_OnInitialize() 'Add the Centigrade point Points.AddPoint "CYGDEMO.UIS:WELL04_TEMP_C", TEMP_CONVERT End Sub
Sub TEMP_CONVERT_OnUpdate(EventType) 'Get a Point object from the Points object. Set TempC = Points.Point("CYGDEMO.UIS:WELL04_TEMP_C")
'Set the HyperPoint value to the point value converted from Centigrade to Fahrenheit. If TempC.Quality = hpQualityGood Then TempFVal = (CDbl(TempC.Value) * 9 / 5) + 32 SetPoint "CYGDEMO.UIS:WELL04_TEMP_F", CStr(TempFVal),_ TempC.TimeStamp, TempC.Status Else SetPoint "CYGDEMO.UIS: End Sub |
The SetPointEx method performs a setpoint operation to a specified tag with the ability to wait for a length of time to verify that the point was set. For more information about adding a SetPoint button to a CygNet Studio screen, which includes this functionality, see the SetPoint Button Tool.
SetPointEx(Tag As String, RawValue as Variant, TimeStamp as Date, Status as Integer, WaitTimeInMs as Integer)
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The point tag, in valid tag string format:
|
|
RawValue |
Yes |
The new value to be written. |
|
Timestamp |
Yes |
The timestamp to be assigned to this value. |
|
Status |
Yes |
The status bit to be updated for the point. |
|
WaitTimeInMs |
Yes |
The amount of time (in milliseconds) to wait for verification. |
Any subsequent lines of code will be suspended until the setpoint method returns.
Example
This method serves as a wrapper for the SetPointEx function by accepting a point tag string and value, checking whether setpoints are authorized on the CYGDEMO.UIS service, then sending the setpoint request.
|
Sub SetPointVal(pointTag, pointVal) Dim serviceName serviceName = "CYGDEMO.UIS"
'Check that setpoints are authorized If Not IsSetPointAuthorized(serviceName) Then MsgBox "You are unauthorized to issue a setpoint command" & _ vbCr & "to the following site service: " & serviceName Else 'Send the request and wait 10 seconds for verification SetPointEx pointTag, pointVal, Now, 0, 10000 End If End Sub |
The SetPointEx2 method performs a setpoint operation to a specified tag with the ability to wait for a length of time to verify that the point was set and change the Base Status and User Status flags. For more information about adding a SetPoint button to a CygNet Studio screen, which includes this functionality, see the SetPoint Button Tool.
SetPointEx2(Tag As String, RawValue As Variant, Timestamp As Date, BaseStatusMask As Integer, BaseStatus As Integer, UserStatusMask As Long, UserStatus As Long, WaitTimeInMs As Integer)
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The point tag, in valid tag string format:
|
|
RawValue |
Yes |
The new value to be written. |
|
Timestamp |
No |
The timestamp to be assigned to this value. |
|
BaseStatusMask |
Yes |
A hex value that contains the base status flags to be changed. See Remarks below. |
|
BaseStatus |
No |
A hex value that contains the base status flags' new statuses. See Remarks below. |
|
UserStatusMask |
No |
A hex value that contains the user status flags to be changed. See Remarks below. |
|
UserStatus |
No |
A hex value that contains the user status flags' new statuses. See Remarks below. |
|
WaitTimeInMs |
No |
The amount of time (in milliseconds) to wait for verification. |
BaseStatusMask and UserStatusMask are hex values representing which flags to change. See the tables below for the hex values of individual flags. The mask is the hex value received after adding the flags' hex values together (ie. h0004 + h0008 = h000C; h0004 + h0008 + h0080 = h008C). This can be hFFFF or hFFFFFFFF to change all the flags.
BaseStatus and UserStatus are hex values representing the flag's new statuses. This is obtained by adding together the hex values of the flags. To have a flag marked, add it to this parameter. To have it cleared, do not add it. Keep in mind that only the flags referenced in the Mask parameters will be affected.
| Base Status Bits | |
|---|---|
| Flag Name | Hex Value |
| Unreliable | h0004 |
| Config Bit 1 (Out-of-Range) | h0008 |
| Config Bit 2 (Low Alarm) | h0010 |
| Config Bit 3 (Low Warning) | h0020 |
| Config Bit 4 (High Warning) | h0040 |
| Config Bit 5 (High Alarm) | h0080 |
| Config Bit 6 (High Deviation) | h0100 |
| Config Bit 7 | h0200 |
| Config Bit 8 | h0800 |
| Config Bit 9 | h4000 |
| Config Bit 10 | h8000 |
| User Status Bits | |
|---|---|
| Flag Name | Hex Value |
| User Bit 1 | h00000001 |
| User Bit 2 | h00000002 |
| User Bit 3 | h00000004 |
| User Bit 4 | h00000008 |
| User Bit 5 | h00000010 |
| User Bit 6 | h00000020 |
| User Bit 7 | h00000040 |
| User Bit 8 | h00000080 |
| User Bit 9 | h00000100 |
| User Bit 10 | h00000200 |
| User Bit 11 | h00000400 |
| User Bit 12 | h00000800 |
| User Bit 13 | h00001000 |
| User Bit 14 | h00002000 |
| User Bit 15 | h00004000 |
| User Bit 16 | h00008000 |
| Config Bit 11 | h04000000 |
| Config Bit 12 | h08000000 |
| Config Bit 13 | h10000000 |
| Config Bit 14 | h40000000 |
| Config Bit 15 | h80000000 |
Example
There are several examples below that show various ways of using the SetPointEx2 method.
|
'This example sets the Unreliable flag (h0004) Sub setEx1() SetPointEx2 "CYGDEMO.UIS.00000123", 12, Now, _ h0004, h0004, h00000000, h00000000, 1000" MsgBox "Point set" End Sub
'This example sets the Unreliable flag (h0004) and clears Out-of-Range (h0008) Sub setEx2() SetPointEx2 "CYGDEMO.UIS.00000123", 12, Now, _ h000C, h0004, h00000000, h00000000, 1000" MsgBox "Point set" End Sub
'This example clears all flags for the given point Sub setEx3() SetPointEx2 "CYGDEMO.UIS.00000123", 12, Now, _ hFFFF, h0000, hFFFFFFFF, h00000000, 1000" MsgBox "Point set" End Sub
'This example sets High Alarm (h0080), sets UserBit 7 (h00000040) 'sets UserBit 15 (h00004000), and clears UserBit 8 (h00000080) Sub setEx4() SetPointEx2 "CYGDEMO.UIS.00000123", 12, Now, _ h0080, h0080, h000040C0, h00004040, 1000" MsgBox "Point set" End Sub |
The SetPointVerifiedFlags method sets the values for the Verified Flags.
SetPointVerifiedFlags(PointTag As String, UpdateFlag1 As Boolean, Flag1 As Boolean, UpdateFlag2 As Boolean, Flag2 As Boolean, UpdateFlag3 As Boolean, Flag3 As Boolean, UpdateFlag4 As Boolean, Flag4 As Boolean)
| Parameter | Required | Description |
|---|---|---|
|
PointTag |
Yes |
The point tag, in valid tag string format:
|
|
UpdateFlag1 |
Yes |
Set to True to update Flag1, False to skip it. |
|
Flag1 |
Yes |
If UpdateFlag1 is True, set this to True to check Flag1 or False to uncheck it. |
|
UpdateFlag2 |
Yes |
Set to True to update Flag2, False to skip it. |
|
Flag2 |
Yes |
If UpdateFlag2 is True, set this to True to check Flag2 or False to uncheck it. |
|
UpdateFlag3 |
Yes |
Set to True to update Flag3, False to skip it. |
|
Flag3 |
Yes |
If UpdateFlag3 is True, set this to True to check Flag3 or False to uncheck it. |
|
UpdateFlag4 |
Yes |
Set to True to update Flag4, False to skip it. |
|
Flag4 |
Yes |
If UpdateFlag4 is True, set this to True to check Flag4 or False to uncheck it. |
Example
The following example shows all possible ways to update flags.
|
Sub setVerifiedFlags() setPointVerifiedFlags "CYGDEMO.UIS.00000195", _ True, True, _ 'Check the first flag True, False, _ 'Uncheck the second flag False, True, _ 'Leave the third flag as is False, False 'Leave the fourth flag as is
edtMessageBox.Text = "Flags have been set" End Sub |
The ShowDataGroupDialog method shows the Data Group dialog box. Also see CxDialogs.ShowDataGroupDialog.
ShowDataGroupDialog(UisOrDdsSiteService As String, FacilityId As String, DataGroupType As String, Ordinal As Integer)
| Parameter | Required | Description |
|---|---|---|
|
UisOrDdsSiteService |
Yes |
The name of a valid UIS or DDS from which to get information , in Site.Service format. |
|
FacilityId |
Yes |
A valid facility ID. |
|
DataGroupType |
Yes |
The Data Group Type of an existing data group. |
|
Ordinal |
Yes |
The ordinal number corresponding to the exact data group to show. This is helpful if there are more than one data groups of the same type. |
Example
The following example illustrates three ways to call this method. The first two methods display Discrete Output data groups, but the first method shows Ordinal 4 and the second shows Ordinal 5. The third method shows the properties dialog box for TESTMETER because no Data Group Type is specified.
|
Sub dataGrpDO4() 'Shows the Discrete Output data group with an ordinal of 4 ShowDataGroupDialog "CYGDEMO.UIS", "TESTMETER", "DO", 4 End Sub
Sub dataGrpDO5() 'Shows the Discrete Output data group with an ordinal of 5 ShowDataGroupDialog "CYGDEMO.UIS", "TESTMETER", "DO", 5 End Sub |
The ShowFacilityRulesDialog method displays the Facility Rules dialog box. Also see CxDialogs.ShowFacilityRulesDialog.
ShowFacilityRulesDialog(InRules As String) As String
| Parameter | Required | Description |
|---|---|---|
|
InRules |
No |
An optional parameter allowing the input of human-readable text or XML to initialize the filter in the dialog box. If this parameter is not specified, the dialog box will not contain any filters upon initialization. |
This method will return the Facility Rule Filter XML created by the dialog box.
The following is an example of a Facility Rule Filter XML which filters all facilities where facility_category = "GENFAC" AND facility_siteservice = "CYGDEMO.UIS".
|
<ExportedRules exportTime="9/24/2011 07:37:46.621" ruleDataIdentifier="FAC Rules"> <Rules enabled="true" inverted="false" op="1" name=""> <Rule enabled="true" name="" referenceAttr="0" compareToType="0" externalData="" value="GENFAC" operator="=" qualifier="Case Insensitive"> <compareItem attr="facility_category"/> </Rule> <Rule enabled="true" name="" referenceAttr="0" compareToType="0" externalData="" value="CYGDEMO.UIS" operator="=" qualifier="Case Insensitive"> <compareItem attr="facility_siteservice"/> </Rule> </Rules> </ExportedRules> |
Example
The following example launches the Facility Rules dialog box and displays the generated rules in a message box.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim strRules strRules = GlobalFunctions.ShowFacilityRulesDialog("")
MsgBox strRules End Sub |
The ShowFacilityRulesDialogSimple method displays the Facility Rules dialog box. The optional InRules parameter allows both "simple" human-readable text and XML as the input to initialize the filter. The method will also output only human-readable text. Also see CxDialogs.ShowFacilityRulesDialogSimple.
Note:
ShowFacilityRulesDialogSimple(InRules As String) As String
| Parameter | Required | Description |
|---|---|---|
|
InRules |
No |
An optional parameter allowing the input of human-readable text or XML to initialize the filter in the dialog box. If this parameter is not specified, the dialog box will not contain any filters upon initialization. |
This method will return the human-readable filter text created by the dialog box.
The following is an example of a facility rule filter input in text format which filters all facilities where facility_id = "TANK1" OR facility_id = "TANK2".
|
facility_id = ToCaseInsensitive('TANK1') OR facility_id = ToCaseInsensitive('TANK2') |
Example
The following example launches the Facility Rules dialog box and displays the generated rules in a message box.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim strRules strRules = GlobalFunctions.ShowFacilityRulesDialogSimple("")
MsgBox strRules End Sub |
The ShowModalView method opens a Studio screen as a dialog box.
ShowModalView(ViewFileName As String, SiteService As Variant, Facility As Variant, Caption As String, Style As Integer, DefaultButton As Integer, Resizable As Boolean, Left As Variant, Top As Variant, Width As Variant, Height As Variant, DictionaryXml As Variant) As Long
| Parameter | Required | Description |
|---|---|---|
|
ViewFileName |
Yes |
A valid file path to a CygNet Studio screen. This may be either a local file path (ex. C:\Folder\Screen.csf), or in the BLOB system (ex. CYGDEMO.BSS\TEST\Screen.csf). |
|
SiteService |
No |
The name of a service, in Site.Service format. |
|
Facility |
No |
A valid facility name that is connected to SiteService. The default is blank. |
|
Caption |
No |
This is the title of the new form. The default is blank, which means that the dialog shows the .csf title. |
|
Style |
No |
Sets the number and type of buttons that appear on the form. 0 = No buttons 1 = OK 2 = OK, Cancel 3 = Yes, No 4 = Yes, No, Cancel 5 = Done The default is 0. |
|
DefaultButton |
No |
Sets which button will be selected when the form displays. 0 will leave all buttons unselected, 1 will select the first button, 2 will select the second, etc. The default is 0. |
|
Resizable |
No |
Set to True to enable resizing of the new form, False to disable it. The default is True. |
|
Left |
No |
The X coordinate of the left side of the form, where 0 is the left side of the screen. The default is 0. Note: Set both "Left" and "Top" to zero to center the dialog box. |
|
Top |
No |
The Y coordinate of the top of the form, where 0 is the top of the screen. The default is 0. |
|
Width |
No |
The number of pixels wide the form will be. The default is 0. Note: Set both "Width" and "Height" to zero to automatically size the dialog box to fit the contained CSF file. |
|
Height |
No |
The number of pixels tall the form will be. The default is 0. |
|
DictionaryXml |
No |
The name of a dictionary object. This will be exported to and useable by the new View window. The default is null. |
Return Value: An integer representing which button was selected to close the form. 1 = OK or Done, 2 = Cancel or Close, 3 = Yes, 4 = No.
Example
The following example opens a form. If the user presses OK on the form, some code is performed. If the user presses Cancel or closes the form, some text is put in a text box.
|
Sub showTest() Dim iRet iRet = ShowModalView("C:\TestScreen.csf", "CYGDEMO.UIS", "CYG_METER", "Test Form", 2, 2, True, 50, 50, 375, 475, objDictionary)
'If the user pressed OK, run some code. 'If the user pressed Cancel or closed the form, don’t do anything If iRet = 1 Then ... 'Code Else edtMessageBox.Text = "Action was canceled" End If End Sub |
The ShowRelativeTimeDialog method displays the Relative Time dialog box. Also see CxDialogs.ShowRelativeTimeDialog.
ShowRelativeTimeDialog(InTime As String) As String
| Parameter | Required | Description |
|---|---|---|
|
InTime |
No |
An optional string used to initialize the Relative Time dialog box. This string can be in one of the following formats:
If this parameter is not specified, the dialog box will be initialized to the current date and time. |
This method will return a string representing the time configured in the dialog box. This format of this string will vary depending on the type of date time configured in the dialog box. If "Absolute Date/Time" is selected, the format of the returned string will be "(M)M/(D)D/YYYY (H)H:MM:SS". If "Relative Date/Time" is selected, the format of the returned string will be "y+/-# m+/-# d+/-# H+/-# M+/-# S+/-#" or "<Current>" if no relative date/time parameters are adjusted. If "Relative Day" is selected, the format of the returned string will be "T+/-#".
Example
The following example launches the Relative Time dialog box initialized to one year ago from the current time, and displays the result in a message box.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim strTime strTime = GlobalFunctions.ShowRelativeTimeDialog("y-1")
MsgBox strTime End Sub |
The ShowRollupConfigDialog method displays the History Rollup Configuration dialog box. Also see CxDialogs.ShowRollupConfigDialog.
ShowRollupConfigDialog(TimeAdjustment As Variant, RollupType As Variant, RollupPeriod As Variant, Units As Variant, TopOfSubUnit As Variant)
| Parameter | Required | Description |
|---|---|---|
|
TimeAdjustment |
Yes |
The time adjustment returned by the dialog box. This string will match the date time configured in the Time Adjustment edit box. |
|
RollupType |
Yes |
The rollup type returned by the dialog box. This string will match the string selected in the Rollup Type combo box. |
|
RollupPeriod |
Yes |
The rollup period returned by the dialog box. This string will match the number configured in the Rollup Period edit box. |
|
Units |
Yes |
The Units returned by the dialog box. This string will match the string selected in the Units combo box. |
|
TopOfSubUnit |
Yes |
The top of subunit offset returned by the dialog box. This string will match the number configured in the Top of SubUnit edit box. |
Example
The following example launches the History Rollup Configuration dialog box and displays each returned parameter in a message box.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim vTimeAdj, vType, vPeriod, vUnits, vTOS GlobalFunctions.ShowRollupConfigDialog vTimeAdj, vType, vPeriod, vUnits, vTOS
MsgBox vTimeAdj MsgBox vType MsgBox vPeriod MsgBox vUnits MsgBox vTOS End Sub |
The ShowUisCmdAuxDialog method displays the UIS Command Auxiliary Information dialog box. Also see CxDialogs.ShowUisCmdAuxDialog.
ShowUisCmdAuxDialog(UisOrDdsSiteService As String, FacilityId As String, UisCmdName As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
UisOrDdsSiteService |
Yes |
The name of a valid UIS or DDS from which to get information , in Site.Service format. For which to modify UIS command auxiliary information. |
|
FacilityId |
Yes |
The facility ID for which to modify UIS command auxiliary information. |
|
UisCmdName |
Yes |
The name of the UIS command for which to modify auxiliary information. |
This method will return false if any of the supplied parameters are invalid.
Example
The following example launches the UIS Command Auxiliary Information dialog box.
|
Sub Dim GlobalFunctions Set GlobalFunctions = CreateObject("CxScript.GlobalFunctions")
Dim vTimeAdj, vType, vPeriod, vUnits, vTOS GlobalFunctions.ShowUisCmdAuxDialog "CYGDEMO.UIS", "FLOWAUTOAP15", "RTUCFGGET" End Sub |
The ShowUisCmdStateDialog method shows the UIS Command State dialog box. Also see CxDialogs.ShowUisCmdStateDialog.
ShowUisCmdStateDialog(UisOrDdsSiteService As String, FacilityId As String, UisCmdName As String, ShowExecutionPrompt As Boolean) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
UisOrDdsSiteService |
Yes |
The name of a valid UIS or DDS from which to get information , in Site.Service format. |
|
FacilityId |
Yes |
A valid facility ID. |
|
UisCmdName |
Yes |
The name of a UIS Command in the FacilityId. |
|
ShowExecutionPrompt |
Yes |
Set to True to show a button to execute the UIS Command, False to hide the button. |
Return Value: A Boolean indicating whether the operation was successful. If ShowExecutionPrompt is set to False, this method will automatically return True.
Example
The following example shows the dialog box for the POLL command and is used to execute it.
|
Sub showCmdDialog() Dim bRet bRet = ShowUisCmdStateDialog ("CYGDEMO.UIS", "CYG_METER", "POLL", True) If bRet Then edtMessageBox.Text = "Successful execution" Else edtMessageBox.Text = "Error executing command" End If End Sub |
The SortArray method sorts an array.
SortArray(Array As Variant, Ascending As Boolean)
| Parameter | Required | Description |
|---|---|---|
|
Array |
Yes |
The array to be sorted. When this method is completed, the sorted values are stored in this variable. |
|
Ascending |
Yes |
Set to True to sort in ascending order (a-z), or False to sort in descending order (z-a). |
Example
The following example sorts an array alphabetically and displays the new array in a list box.
|
Sub sortLetters() Dim arrLetters, item arrLetters = Array("a", "l", "ab", "z", "aa")
SortArray arrLetters, True lstSort.ResetContent For Each item In arrLetters lstSort.AddString(letter) Next 'Sorted array: a, aa, ab, l, z End Sub |
The TogglePointVerifiedFlags method toggles the Verified Flags for a point.
TogglePointVerifiedFlags(PointTag As String, ToggleFlag1 As Boolean, ToggleFlag2 As Boolean, ToggleFlag3 As Boolean, ToggleFlag4 As Boolean)
| Parameter | Required | Description |
|---|---|---|
|
PointTag |
Yes |
The point tag, in valid tag string format:
|
|
ToggleFlag1 |
Yes |
Set to True to toggle Verified Flag 1, False to keep its value. |
|
ToggleFlag2 |
Yes |
Set to True to toggle Verified Flag 2, False to keep its value. |
|
ToggleFlag3 |
Yes |
Set to True to toggle Verified Flag 3, False to keep its value. |
|
ToggleFlag4 |
Yes |
Set to True to toggle Verified Flag 4, False to keep its value. |
Example
The following example toggles the status for flags 1, 3, and 4.
|
Sub toggleFlags() TogglePointVerifiedFlags "CYGDEMO.UIS.00000080", True, False, True, True MsgBox "Verified Flags 1, 3, and 4 have been toggled" End Sub |